﻿using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using ZeroSum.Domain.Entities;

namespace ZeroSum.Plugin.Authorization.Datas.Aggregates.MenuAggregate;

/// <summary>
///     菜单表
/// </summary>
[Description("菜单表")]
public class MenuBase : BaseEntity<long>, ISoftDelete
{
    /// <summary>
    ///     名称
    /// </summary>
    [Description("名称")]
    [Required]
    [MaxLength(20)]
    public string? Name { get; set; }

    /// <summary>
    ///     编码
    /// </summary>
    [Description("编码")]
    [Required]
    [MaxLength(50)]
    public string? Code { get; set; }

    /// <summary>
    ///     菜单类型（字典 0目录 1菜单 2按钮）
    /// </summary>
    [Description("菜单类型")]
    public MenuType Type { get; set; }

    /// <summary>
    ///     图标
    /// </summary>
    [Description("图标")]
    [MaxLength(20)]
    public string? Icon { get; set; }

    /// <summary>
    ///     路由地址
    /// </summary>
    [Description("路由地址")]
    [MaxLength(100)]
    public string? Router { get; set; }

    /// <summary>
    ///     组件地址
    /// </summary>
    [Description("组件地址")]
    [MaxLength(100)]
    public string? Component { get; set; }

    /// <summary>
    ///     权限标识
    /// </summary>
    [Description("权限标识")]
    [MaxLength(100)]
    public string? Permission { get; set; }

    /// <summary>
    ///     应用分类（应用编码）
    /// </summary>
    [Description("应用分类")]
    [MaxLength(50)]
    public string? Application { get; set; }

    /// <summary>
    ///     打开方式（字典 0无 1组件 2内链 3外链）
    /// </summary>
    [Description("打开方式")]
    public MenuOpenType OpenType { get; set; } = MenuOpenType.None;

    /// <summary>
    ///     是否可见（Y-是，N-否）
    /// </summary>
    [Description("是否可见")]
    [MaxLength(5)]
    public bool Visible { get; set; } = true;

    /// <summary>
    ///     内链地址
    /// </summary>
    [Description("内链地址")]
    [MaxLength(100)]
    public string? Link { get; set; }

    /// <summary>
    ///     重定向地址
    /// </summary>
    [Description("重定向地址")]
    [MaxLength(100)]
    public string? Redirect { get; set; }

    /// <summary>
    ///     权重（字典 1系统权重 2业务权重）
    /// </summary>
    [Description("权重")]
    public MenuWeight Weight { get; set; } = MenuWeight.DefaultWeight;

    /// <summary>
    ///     排序
    /// </summary>
    [Description("排序")]
    public int Sort { get; set; } = 100;

    /// <summary>
    ///     备注
    /// </summary>
    [Description("备注")]
    [MaxLength(100)]
    public string? Remark { get; set; }

    public bool IsDeleted { get; set; }
}